/**
 * 
 */
package com.scitc.pleasurevideo.util;

import android.content.Context;
import android.view.View;
import android.widget.Toast;

import com.scitc.pleasurevideo.data.SystemSettingDataMan;
import com.scitc.pleasurevideo.dialog.DialogSettingRadio;

import java.util.ArrayList;
import java.util.List;

/**
 * @author tata
 *
 */
public class TimerSettingUtils {

	static String time[] = new String[] { "不设置定时关闭", "5分钟后关闭", "15分钟后关闭", "30分钟后关闭" , "1个小时后关闭", "2个小时后关闭", };
	static int times[] =  { -100000,5*60*1000, 15*60*1000, 30*60*1000, 60*60*1000, 120*60*1000};

	public static void showTimerSettingDialog(final View view,final Context context) {
		List<String> items = new ArrayList<String>();
		int type = SystemSettingDataMan.getDataMan().getTimerSettingTime();
		for(int i=0;i<time.length;i++){
			String value = time[i];
			if(type == i){
				value+="(已选择)";
			}
			items.add(value);
		}

		 new DialogSettingRadio(view, context, "定时关闭", time, type, position -> {
			 Toast.makeText(context, time[position], Toast.LENGTH_SHORT).show();
			 SystemSettingDataMan.getDataMan().saveTimerTime(position,times[position]);
		 });
	}

}
